package cn.legend.travel.destination.main.dao.persist.repository.impl;

import cn.legend.travel.destination.main.dao.persist.mapper.AskMapper;
import cn.legend.travel.destination.main.dao.persist.repository.IAskRepository;
import cn.legend.travel.destination.main.pojo.vo.AnswerVO;
import cn.legend.travel.destination.main.pojo.vo.AskVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public class AskRepositoryImpl implements IAskRepository {
    @Autowired
    private AskMapper askMapper;
    @Override
    public List<AskVO> selectByCity(String city) {

        List<AskVO> askVOS = askMapper.selectByCity(city);
        for (AskVO askVO : askVOS) {
            AnswerVO answerVO = askMapper.selectByquestionId(askVO.getId());
            askVO.setAnswerVO(answerVO);
        }
        return askVOS;
    }
}
